<?php
error_reporting(E_ALL ^ E_NOTICE);

set_time_limit(0);
$conn = @mysql_connect("localhost","root","root");
if (!$conn){
    die("Could not connect：" . mysql_error());
}

mysql_select_db("hero", $conn);
mysql_query("set names 'UTF-8'"); 
 
$deviceid_query =  mysql_query("SELECT  deviceid FROM report_nojailbreak_total");

while($deviceid = mysql_fetch_array($deviceid_query))
{
     //总付费金额
    $money_query = mysql_query("SELECT cents099 * 99+Cents1999 * 1999+ Cents499 *499 + Cents4999 * 4999 + Cents9999*9999
FROM `report_nojailbreak_total`
where deviceid = '$deviceid[deviceid]'");

    $money = mysql_fetch_array($money_query);

 
$sql = "UPDATE report_nojailbreak_total SET money= '$money[0]' WHERE deviceid= '$deviceid[deviceid]'";

if(mysql_query($sql,$conn)){
    echo "1 update is ok!";
} else {
    echo "failed：".mysql_error();
}

}
?>
